package com.springboot.demo.web;

import com.springboot.demo.entity.Notice;
import com.springboot.demo.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class IndexController {

    @Autowired
    private NoticeService noticeService;

    @RequestMapping("/index")
    public String index(Model model){

        List<Notice> noteList = noticeService.getNoticeByOrder();
        model.addAttribute("notices",noteList);
        return "index";
    }
}
